<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        /* trim() 去除字符串前后的空格
        
        /^\s+|\s+$/g  面试题
        */
        var str = "   hello   ";
        var arr = []
        arr.push(str.trim())
        console.log(arr)
    </script>
</body>
</html>